// @ts-nocheck
// 从依赖包中导入路由函数 createRouter 和 createWebHistory。
import { createRouter, createWebHistory } from "vue-router";

// 定义一些路由。每个路由都需要映射到一个组件。
const routes = [
    {
        path: "/",
        redirect: "/admin",
    },
    // 管理员
    {
        path: "/admin",
        name: "AdminIndex",
        component: () => import("./pages/AdminIndex.vue"),
        children: [
            {
                path: "user",
                name: "UserIndexPage",
                component: () => import("./pages/user/IndexPage.vue"),
            },
            {
                path: "userAnalysis",
                name: "UserAnalysisIndexPage",
                component: () => import("./pages/user/DataAnalysisIndex.vue"),
            },
            {
                path: "book",
                name: "BookIndexPage",
                component: () => import("./pages/book/IndexPage.vue"),
            },
        ]
    },
    // 用户
    {
        path: "/user",
        name: "UserIndex",
        component: () => import("./pages/UserIndex.vue"),
        children: [

        ]
    },
];

// 使用 createRouter 方法创建一个路由实例 router
const router = createRouter({
    history: createWebHistory(),
    routes, // `routes: routes` 的缩写
});

// 导出路由对象。
export default router;